package pl.diagnoser.server.persistance.map;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "T_SEARCH_RESULT_ATTRIBUTES")
public class SearchResultAttributes implements Serializable {

	private static final long serialVersionUID = 1L;
	private long searchResultAttributesId;
	private SearchResult searchResult;
	private String attributeName;
	private String attributeValue;
	
	public SearchResultAttributes(){}
	public SearchResultAttributes(long searchResultAttributesId,
			SearchResult searchResult, String attributeName,
			String attributeValue) {
		super();
		this.searchResultAttributesId = searchResultAttributesId;
		this.searchResult = searchResult;
		this.attributeName = attributeName;
		this.attributeValue = attributeValue;
	}
	public SearchResultAttributes(SearchResult searchResult, String attributeName,
			String attributeValue) {
		super();
		this.searchResult = searchResult;
		this.attributeName = attributeName;
		this.attributeValue = attributeValue;
	}
	
	@Id
	@GeneratedValue
	@Column( name="SEARCH_RESULT_ATTRIBUTES_ID", unique = true, nullable = false )
	public long getSearchResultAttributesId() {
		return searchResultAttributesId;
	}
	public void setSearchResultAttributesId(long searchResultAttributesId) {
		this.searchResultAttributesId = searchResultAttributesId;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="SEARCH_RESULT_ID")
	public SearchResult getSearchResult() {
		return searchResult;
	}
	public void setSearchResult(SearchResult searchResult) {
		this.searchResult = searchResult;
	}
	
	@Column( name="ATTRIBUTE_NAME", unique = false, nullable = false )
	public String getAttributeName() {
		return attributeName;
	}
	public void setAttributeName(String attributeName) {
		this.attributeName = attributeName;
	}
	
	@Column( name="ATTRIBUTE_VALUE", unique = false, nullable = false )
	public String getAttributeValue() {
		return attributeValue;
	}
	public void setAttributeValue(String attributeValue) {
		this.attributeValue = attributeValue;
	}
}
